﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuxiWTO.Mapping;
using WutiWTO.Common;
using System.Data.Linq;


namespace WuxiWTO.Web.backend
{
    public partial class userDetailsReadonly : BasePage
    {
        WTODataContext contex = new WTODataContext();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int uid = int.Parse(Request.QueryString["id"]);
                GetUserInfo(uid);
            }
        }

        private void GetUserInfo(int uid)
        {
            supporter user = contex.supporters.SingleOrDefault(p => p.supporter_id == uid);
            if (user != null)
            {
                this.lblEmailO.Text = user.email;
                this.lblEnterpriseName.Text = user.enterprise_name;
                this.lblLoginNameO.Text = user.supporter_login_name;
                this.lblNameO.Text = user.enterprise_name;
                //this.lblPurposeO.Text = GetPurposeByCode(user.purpose);
                this.lblTelephoneO.Text = user.mobile;
                this.lblContact.Text = user.contact;
                this.lblPosition.Text = user.position;
                this.lblAddress.Text = user.enterprise_address;

            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "fa", "alert('参数传递失败');", true);
                return;
            }
        }
    }
}